package consumer.service.fallback;

import consumer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Service;

@Service
public class UserServiceFallbackFactory implements FallbackFactory<UserService> {

    @Autowired
    private UserServiceFallback userServiceFallback;

    @Override
    public UserService create(Throwable cause) {
        System.out.println("UserServiceFallbackFactory.create()");

        System.out.println("cause = " + cause);

        return userServiceFallback;
    }
}
